package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.MtypeXO;
import com.indusfo.spc.service.MtypeXOService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @ProjectName: IEIS2-COM
 * @Package: com.indusfo.spc.controller
 * @ClassName: MtypeXOController
 * @Author: 熊冰
 * @Description: 物料类型 视图层
 * @Date: 2019/8/21 10:10
 * @Version: 1.0
 */
@Controller
@RequestMapping("/mtypeXO")
public class MtypeXOController {
    /**
     * 注入service
     */

    @Resource
    MtypeXOService mtypeXOService;
    //新增
    @RequestMapping(value="insertMtypeXO")
    @ResponseBody
    public JSONObject insertMtypeXO(MtypeXO mtypeXO){
        mtypeXO.setMtypeId(null);
        JSONObject json = mtypeXOService.insertOrUpdateMtypeXO(mtypeXO) ;
        return json;

    }
    //删除
    @RequestMapping(value="delMtypeXO")
    @ResponseBody
    public JSONObject delMtypeXO(Long[] ids){
        Integer   dataState = 2;
        JSONObject json = mtypeXOService.deleteMtypeXO(ids,dataState);
        return json;

    }
    //修改
    @RequestMapping(value="updateMtypeXO")
    @ResponseBody
    public JSONObject updateMtypeXO(MtypeXO mtypeXO){
        JSONObject json = mtypeXOService.insertOrUpdateMtypeXO(mtypeXO) ;
        return json;

    }
    //查询
    @RequestMapping(value="queryMtypeXO")
    @ResponseBody
    public JSONObject queryMtypeXO(MtypeXO mtypeXO){
        JSONObject json = mtypeXOService.listMtypeXO(mtypeXO);
        return json;
    }
    //停用
    @RequestMapping(value="stopMtypeXO")
    @ResponseBody
    public JSONObject stopMtypeXO(Long[] ids){
        Integer   dataState = 3;
        JSONObject json = mtypeXOService.deleteMtypeXO(ids,dataState);
        return json;

    }
    //启用
    @RequestMapping(value="startMtypeXO")
    @ResponseBody
    public JSONObject startMtypeXO(Long[] ids){
        Integer   dataState = 1;
        JSONObject json = mtypeXOService.deleteMtypeXO(ids,dataState);
        return json;

    }

    //树
    @RequestMapping(value="treeMtypeXO")
    @ResponseBody
    public JSONObject treeMtypeXO(MtypeXO mtypeXO){
        JSONObject json = mtypeXOService.treeMtypeXO(mtypeXO);
        return json;

    }

}
